.class public Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;
.super Lorg/apache/http/impl/DefaultHttpRequestFactory;
.source "UpnpHttpRequestFactory.java"


# static fields
.field private static final BASIC:[Ljava/lang/String;

.field private static final WITH_ENTITY:[Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 4

    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/String;

    const-string v1, "SUBSCRIBE"

    const/4 v2, 0x0

    aput-object v1, v0, v2

    const-string v1, "UNSUBSCRIBE"

    const/4 v3, 0x1

    aput-object v1, v0, v3

    .line 1
    sput-object v0, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->BASIC:[Ljava/lang/String;

    new-array v0, v3, [Ljava/lang/String;

    const-string v1, "NOTIFY"

    aput-object v1, v0, v2

    .line 2
    sput-object v0, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->WITH_ENTITY:[Ljava/lang/String;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .line 1
    invoke-direct {p0}, Lorg/apache/http/impl/DefaultHttpRequestFactory;-><init>()V

    return-void
.end method

.method private static isOneOf([Ljava/lang/String;Ljava/lang/String;)Z
    .locals 3

    const/4 v0, 0x0

    const/4 v1, 0x0

    .line 1
    :goto_0
    array-length v2, p0

    if-ge v1, v2, :cond_1

    .line 2
    aget-object v2, p0, v1

    invoke-virtual {v2, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_0

    const/4 p0, 0x1

    return p0

    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    return v0
.end method


# virtual methods
.method public newHttpRequest(Ljava/lang/String;Ljava/lang/String;)Lorg/apache/http/HttpRequest;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/apache/http/MethodNotSupportedException;
        }
    .end annotation

    .line 5
    sget-object v0, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->BASIC:[Ljava/lang/String;

    invoke-static {v0, p1}, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->isOneOf([Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 6
    new-instance v0, Lorg/apache/http/message/BasicHttpRequest;

    invoke-direct {v0, p1, p2}, Lorg/apache/http/message/BasicHttpRequest;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    return-object v0

    .line 7
    :cond_0
    sget-object v0, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->WITH_ENTITY:[Ljava/lang/String;

    invoke-static {v0, p1}, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->isOneOf([Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 8
    new-instance v0, Lorg/apache/http/message/BasicHttpEntityEnclosingRequest;

    invoke-direct {v0, p1, p2}, Lorg/apache/http/message/BasicHttpEntityEnclosingRequest;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    return-object v0

    .line 9
    :cond_1
    invoke-super {p0, p1, p2}, Lorg/apache/http/impl/DefaultHttpRequestFactory;->newHttpRequest(Ljava/lang/String;Ljava/lang/String;)Lorg/apache/http/HttpRequest;

    move-result-object p1

    return-object p1
.end method

.method public newHttpRequest(Lorg/apache/http/RequestLine;)Lorg/apache/http/HttpRequest;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/apache/http/MethodNotSupportedException;
        }
    .end annotation

    if-eqz p1, :cond_0

    .line 1
    invoke-interface {p1}, Lorg/apache/http/RequestLine;->getMethod()Ljava/lang/String;

    move-result-object v0

    .line 2
    invoke-interface {p1}, Lorg/apache/http/RequestLine;->getUri()Ljava/lang/String;

    move-result-object p1

    .line 3
    invoke-virtual {p0, v0, p1}, Lorg/teleal/cling/transport/impl/apache/UpnpHttpRequestFactory;->newHttpRequest(Ljava/lang/String;Ljava/lang/String;)Lorg/apache/http/HttpRequest;

    move-result-object p1

    return-object p1

    .line 4
    :cond_0
    new-instance p1, Ljava/lang/IllegalArgumentException;

    const-string v0, "Request line may not be null"

    invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p1
.end method
